﻿using System;
using System.Configuration;

namespace Web.Common
{
    public class PubConstant
    {
        private static string _connectionstring = "";
        /// <summary>
        /// 获取连接字符串
        /// </summary>
        public static string ConnectionString
        {
            get
            {
                _connectionstring = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
                return _connectionstring;
            }
            set { _connectionstring = value; }
        }

        /// <summary>
        /// 得到web.config里配置项的数据库连接字符串。
        /// </summary>
        /// <param name="configName">web.config配置项的数据连接字符串</param>
        public static string GetConnectionString(string configName)
        {
            string _connectionstring = ConfigurationManager.AppSettings[configName];
            return _connectionstring;
        }
    }
}
